﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace start
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string path = "";
        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = "";//默认打开 的文件名
            openFileDialog1.Filter = "随便填|*";//设置后缀
            if (openFileDialog1.ShowDialog() == DialogResult.OK);
            {
                path = openFileDialog1.FileName;    //获取路径
                pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);//显示图片
                label1.Text = "打开成功";
            }
        }
    }
}
